package common.query;

import org.springframework.data.mongodb.core.query.Query;

import java.io.Serializable;
import java.util.List;

/**
 * @author weixiaoqing
 * @description
 * @create 2017/9/6
 * @company 上海富捷信息技术有限公司
 */
public abstract class AbstractPageQuery implements Serializable {
	private static final long serialVersionUID = 376600555466274198L;

	private Integer pageNum = 1;
	private Integer pageSize = 10;

	private List<Order> orders;

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
	
	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public List<Order> getOrders() {
		return orders;
	}

	public void setOrders(List<Order> orders) {
		this.orders = orders;
	}


	public int getSkip() {
		return (getPageNum() - 1) * getPageSize();
	}

	public int getLimit() {
		return getPageNum() * getPageSize();
	}

	/**
	 * 生成Query查询块
	 *
	 * @return
	 */
	public abstract Query convertPageQuery();



}
